home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!cs.utexas.edu!tut.cis.ohio-state.edu!rutgers!aramis.rutgers.edu!dartagnan.rutgers.edu!mcgrew
- From: mcgrew@dartagnan.rutgers.edu (Charles Mcgrew)
- Newsgroups: comp.sources.sun
- Subject: v01i021: Tooltool - a suntools user interface builder, Part 02/13
- Message-ID: <Jun.7.00.10.00.1989.23482@dartagnan.rutgers.edu>
- Date: 7 Jun 89 04:10:03 GMT
- Organization: Rutgers Univ., New Brunswick, N.J.
- Lines: 1444
- Approved: mcgrew@aramis.rutgers.edu
-
- Submitted-by: Chuck Musciano <chuck@trantor.harris-atd.com>
- Posting-number: Volume 1, Issue 21
- Archive-name: tooltool2.1c/part02
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 2 (of 13)."
- # Contents: func_fix.c samples/README samples/keytool.defaults.uu
- # samples/lpq2.tt samples/top.tt samples/vt100/edtkeys.ras.uu
- # samples/vt100/vt102tool.tt samples/vt100/vtem.c symbols.c
- # Wrapped by chuck@melmac on Thu Jun 1 10:39:27 1989
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'func_fix.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'func_fix.c'\"
- else
- echo shar: Extracting \"'func_fix.c'\" \(5847 characters\)
- sed "s/^X//" >'func_fix.c' <<'END_OF_FILE'
- X/************************************************************************/
- X/* Copyright 1988 by Chuck Musciano and Harris Corporation */
- X/* */
- X/* Permission to use, copy, modify, and distribute this software */
- X/* and its documentation for any purpose and without fee is */
- X/* hereby granted, provided that the above copyright notice */
- X/* appear in all copies and that both that copyright notice and */
- X/* this permission notice appear in supporting documentation, and */
- X/* that the name of Chuck Musciano and Harris Corporation not be */
- X/* used in advertising or publicity pertaining to distribution */
- X/* of the software without specific, written prior permission. */
- X/* Chuck Musciano and Harris Corporation make no representations */
- X/* about the suitability of this software for any purpose. It is */
- X/* provided "as is" without express or implied warranty. */
- X/* */
- X/* The sale of any product based wholely or in part upon the */
- X/* technology provided by tooltool is strictly forbidden without */
- X/* specific, prior written permission from Harris Corporation. */
- X/* Tooltool technology includes, but is not limited to, the source */
- X/* code, executable binary files, specification language, and */
- X/* sample specification files. */
- X/************************************************************************/
- X
- X#include <stdio.h>
- X
- X#include "tooltool.h"
- X
- X#define advance_queue_ptr(q) ((q) = ((q) + 1) % MAX_EVENTS)
- X
- X#define MAX_EVENTS 16
- X
- Xtypedef struct fk_data fk_rec, *fk_ptr;
- X
- Xstruct fk_data {int candidate;
- X int true_event;
- X char *expansion;
- X };
- X
- XPRIVATE Event event_queue[MAX_EVENTS];
- XPRIVATE Event saved_event[MAX_EVENTS];
- XPRIVATE int queue_head = 0;
- XPRIVATE int queue_tail = 0;
- XPRIVATE int state = 0;
- X
- XPRIVATE fk_rec func_key[] = {{TRUE, KEY_LEFT(2), "\033[193z"},
- X {TRUE, KEY_LEFT(3), "\033[194z"},
- X {TRUE, KEY_LEFT(4), "\033[195z"},
- X {TRUE, KEY_LEFT(5), "\033[196z"},
- X {TRUE, KEY_LEFT(6), "\033[197z"},
- X {TRUE, KEY_LEFT(7), "\033[198z"},
- X {TRUE, KEY_LEFT(8), "\033[199z"},
- X {TRUE, KEY_LEFT(9), "\033[200z"},
- X {TRUE, KEY_LEFT(10), "\033[201z"},
- X {TRUE, KEY_TOP(1), "\033[224z"},
- X {TRUE, KEY_TOP(2), "\033[225z"},
- X {TRUE, KEY_TOP(3), "\033[226z"},
- X {TRUE, KEY_TOP(4), "\033[227z"},
- X {TRUE, KEY_TOP(5), "\033[228z"},
- X {TRUE, KEY_TOP(6), "\033[229z"},
- X {TRUE, KEY_TOP(7), "\033[230z"},
- X {TRUE, KEY_TOP(8), "\033[231z"},
- X {TRUE, KEY_TOP(9), "\033[232z"},
- X {TRUE, KEY_RIGHT(1), "\033[208z"},
- X {TRUE, KEY_RIGHT(2), "\033[209z"},
- X {TRUE, KEY_RIGHT(3), "\033[210z"},
- X {TRUE, KEY_RIGHT(4), "\033[211z"},
- X {TRUE, KEY_RIGHT(5), "\033[212z"},
- X {TRUE, KEY_RIGHT(6), "\033[213z"},
- X {TRUE, KEY_RIGHT(7), "\033[214z"},
- X {TRUE, KEY_RIGHT(8), "\033[215z"},
- X {TRUE, KEY_RIGHT(9), "\033[216z"},
- X {TRUE, KEY_RIGHT(10), "\033[217z"},
- X {TRUE, KEY_RIGHT(11), "\033[218z"},
- X {TRUE, KEY_RIGHT(12), "\033[219z"},
- X {TRUE, KEY_RIGHT(13), "\033[220z"},
- X {TRUE, KEY_RIGHT(14), "\033[221z"},
- X {TRUE, KEY_RIGHT(15), "\033[222z"},
- X {NULL, NULL, NULL}};
- X
- X/************************************************************************/
- XPRIVATE enqueue_event(event)
- X
- XEvent *event;
- X
- X{
- X event_queue[queue_head] = *event;
- X if (advance_queue_ptr(queue_head) == queue_tail)
- X abend("internal event queue overflow");
- X}
- X
- X/************************************************************************/
- XPRIVATE Event *dequeue_event()
- X
- X{ Event *result;
- X
- X if (queue_tail == queue_head)
- X return(NULL);
- X result = &(event_queue[queue_tail]);
- X advance_queue_ptr(queue_tail);
- X return(result);
- X}
- X
- X/************************************************************************/
- XPRIVATE reset_state_machine(enqueue_events)
- X
- Xint enqueue_events;
- X
- X{ int i;
- X
- X if (enqueue_events)
- X for (i = 0; i < state; i++)
- X enqueue_event(&(saved_event[i]));
- X for (i = 0; func_key[i].expansion; i++)
- X func_key[i].candidate = TRUE;
- X state = 0;
- X}
- X
- X/************************************************************************/
- XPRIVATE advance_state_machine(event)
- X
- Xregister Event *event;
- X
- X{ register int candidates;
- X register fk_ptr last_match, key;
- X
- X for (key = func_key, candidates = 0; key->expansion; key++)
- X if (key->candidate && key->expansion[state] == event_id(event)) {
- X candidates++;
- X last_match = key;
- X }
- X else
- X key->candidate = FALSE;
- X if (candidates == 0) {
- X reset_state_machine(TRUE);
- X enqueue_event(event);
- X }
- X else if (candidates == 1 && last_match->expansion[state + 1] == '\0') {
- X event_set_id(event, last_match->true_event);
- X reset_state_machine(FALSE);
- X enqueue_event(event);
- X }
- X else {
- X saved_event[state] = *event;
- X if (++state >= MAX_EVENTS)
- X abend("oveflowed internal event buffer");
- X }
- X}
- X
- X/************************************************************************/
- XPRIVATE Notify_value function_check(win, event, arg, type)
- X
- XWindow win;
- XEvent *event;
- XNotify_arg arg;
- XNotify_event_type type;
- X
- X{ Notify_value result;
- X
- X if (event_is_ascii(event) || event_is_meta(event))
- X if (event_is_down(event))
- X advance_state_machine(event);
- X else
- X reset_state_machine(TRUE);
- X else {
- X reset_state_machine(TRUE);
- X enqueue_event(event);
- X }
- X while (event = dequeue_event())
- X if ((result = notify_next_event_func(win, event, arg, type)) != NOTIFY_DONE)
- X return(result);
- X return(NOTIFY_DONE);
- X}
- X
- X/************************************************************************/
- XEXPORT init_function_fix(win)
- X
- XWindow win;
- X
- X{
- X window_set(win, WIN_CONSUME_KBD_EVENT, WIN_UP_ASCII_EVENTS, 0);
- X notify_interpose_event_func(win, function_check, NOTIFY_SAFE);
- X}
- END_OF_FILE
- if test 5847 -ne `wc -c <'func_fix.c'`; then
- echo shar: \"'func_fix.c'\" unpacked with wrong size!
- fi
- # end of 'func_fix.c'
- fi
- if test -f 'samples/README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'samples/README'\"
- else
- echo shar: Extracting \"'samples/README'\" \(4704 characters\)
- sed "s/^X//" >'samples/README' <<'END_OF_FILE'
- X This directory contains several sample tooltool specifications
- Xwhich you can use to help learn tooltool. All files ending in ".tt"
- Xare tooltool files. The samples contained herein are:
- X
- X lpq.tt
- X queue.c
- X laserwriter.icon
- X This specification uses a custom application (queue.c)
- X to show how a user could build a new windowed application
- X from scratch using a small C program and a tooltool
- X file. Compile queue.c (using "cc -O -o queue queue.c")
- X and type "tooltool -f lpq.tt" to see the results. Lpq.tt
- X creates a windowed print queue monitor which polls the
- X print queue. Closing the window stops the polling,
- X opening it restarts it, as do the buttons in the gadget
- X panel. You can adjust the polling rate using the slider.
- X
- X lpq2.tt
- X tty.c
- X This is another queue tool, but written with all the
- X smarts in the tooltool file itself. It uses /bin/cat
- X to write to the display. This is a good example of
- X the new features in tooltool 2.0.
- X
- X top.tt
- X top.icon
- X Top.tt turns the popular top command into a windowed
- X application. Common top commands have been placed on
- X buttons, and you can still type to top like you used to.
- X
- X rn.tt
- X news.icon
- X This turns rn, the news reading program, into a windowed
- X news reading program. Again, common commands are on
- X buttons, and less used commands are in a menu. You can
- X add to or change rn.tt to suit your own tastes, depending
- X on how you like to use rn.
- X
- X calc.tt
- X This is the sample file discussed in the documentation.
- X It uses very few tooltool options, and serves as a simple
- X introductory example to tooltool. You could jazz this up
- X with an icon, and some other buttons to perform other
- X arithmetic operations.
- X
- X stopwatch.tt
- X stopwatch.icon
- X This creates a handy stopwatch tool, entirely within tooltool.
- X It can count up or down, can take a split time, and can be set
- X by clicking on the appropriate digits. It offers tenth or
- X single second resolution.
- X
- X keytool
- X keytool.l
- X keytool.r.14
- X keytool.defaults
- X Keytool is a different kind of tooltool application. It is
- X actually a shell script, which builds a specification for
- X tooltool. It is a good example of how to process command
- X line arguments for a tooltool application, and is a complex
- X example of using tooltool. Basically, keytool lets you
- X reprogram your keyboard, save those definitions and have them
- X recalled when you next invoke keytool. To define keys and mouse
- X actions, click shift-control-meta mouse right to see the
- X programming window. Click on the key (and shift pattern)
- X you want to define, and type the definition. A typical
- X invocation would be "keytool /bin/csh" to create a shell
- X window with programmable keys. Since keytool is a shell
- X script, you invoke it directly, instead of using "tooltool -f
- X keytool". Keytool is courtesy of Ken Laprade, here at Harris.
- X Try it!
- X
- X Before using keytool, you must unpack the defaults and font
- X files by typing:
- X
- X uudecode keytool.defaults.uu
- X uudecode keytool.r.14.uu
- X
- X Then you can successfully run keytool.
- X
- X Note that keytool has its own special font, which you should
- X install in /usr/lib/fonts/fixedwidthfonts if you make keytool
- X an installed tool at your site. Don't forget to fix up the
- X keytool reference to this font when you move it. The same
- X goes for the keytool.defaults file, which we keep in
- X /usr/local/lib.
- X
- X vt100
- X This directory contains a complete vt100 emulator with a tooltool
- X wrapper. See the VTEM_README file in this directory for more
- X information. You'll need to create the emulator before you can use
- X it with tooltool; check the Makefile for the appropriate information.
- X
- XIn all of these files, references are made to icon files, font files, and
- Xapplication names. If you wish to make these samples real commands, you should
- Xput the icons and associated files in a public place and modify the .tt
- Xfile accordingly. At Harris, we put all .tt files in /usr/local/lib/tooltool,
- Xand icons go in /usr/local/images. The fonts used by these files are Sun
- Xstandards, so that should be no problem. Finally, you should create little
- Xshell files to invoke tooltool transparently when the command name is typed:
- X
- X lpqtool:
- X tooltool -f /usr/local/lib/tooltool/lpq.tt
- X or
- X tooltool -f /usr/local/lib/tooltool/lpq2.tt
- X
- X toptool:
- X tooltool -f /usr/local/lib/tooltool/top.tt
- X
- X newstool:
- X tooltool -f /usr/local/lib/tooltool/rn.tt
- X
- X calctool:
- X tooltool -f /usr/local/lib/tooltool/calc.tt
- X
- X stopwatchtool:
- X tooltool -f /usr/local/lib/tooltool/stopwatch.tt
- X
- X supershelltool:
- X keytool /bin/csh
- X
- XOf course, replace /usr/local/lib/tooltool with the pathname of the place
- Xyou keep the tooltool file.
- END_OF_FILE
- if test 4704 -ne `wc -c <'samples/README'`; then
- echo shar: \"'samples/README'\" unpacked with wrong size!
- fi
- # end of 'samples/README'
- fi
- if test -f 'samples/keytool.defaults.uu' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'samples/keytool.defaults.uu'\"
- else
- echo shar: Extracting \"'samples/keytool.defaults.uu'\" \(2823 characters\)
- sed "s/^X//" >'samples/keytool.defaults.uu' <<'END_OF_FILE'
- Xbegin 666 keytool.defaults
- XM4T5005)!5$]2/0D*4%))34%260I,,@D8$PD5&!,)%1@3"2<G"1MJ?@DG)PDG
- XM)PDG)PI,,PD8!@D;,1@&"1LQ& 8))R<)&VHM,1@&"2<G"2<G"2<G"DPT"1AB
- XM"1AK"1AK"2<G"1MJ7@DG)PDG)PDG)PI,.0D;:@D;:G@)&VIX"2<G"2<G"2<G
- XM"2<G"2<G"DPQ, D;* D;:G@)&VIX"2<G"2<G"2<G"2<G"2<G"D8Q"1MJ"1MJ
- XM> D;:G@))R<))R<))R<))R<))R<*1C()&R@)&VIX"1MJ> DG)PDG)PDG)PDG
- XM)PDG)PI&,PD;,PDG)PDG)PDG)PDG)PDG)PDG)PDG)PI&- D;:G<))R<))R<)
- XM)R<))R<))R<))R<))R<*1C4)&VIX9PD8/0D8/0DG)PDG)PDG)PDG)PDG)PI&
- XM-@D;*',)&RAS"1LH<PDG)PDG)PDG)PDG)PDG)PI&-PD;:GAQ( T)&VIX<2!L
- XM87-T#0D;:GAQ(&QA<W0-"2<G"2<G"2<G"2<G"2<G"D8X"1D)&VIX;"!T#0D;
- XM:GAL('0-"2<G"2<G"2<G"2<G"2<G"D8Y"1MJ>0D;:GAC(&0@#0D;:GAC(&0@
- XM#0DG)PDG)PDG)PDG)PDG)PI2,0EY"7D)>0DG)PDG)PDG)PDG)PDG)PI2,@EB
- XM"6()8@DG)PDG)PDG)PDG)PDG)PI2,PD!"0$) 0DG)PDG)PDG)PDG)PDG)PI2
- XM- D-"0T)#0DG)PDG)PDG)PDG)PDG)PI2-0D@"2 )( DG)PDG)PDG)PDG)PDG
- XM)PI2-@D%"04)!0DG)PDG)PDG)PDG)PDG)PI2-PD!"1@H"1@H"2<G"2<G"2<G
- XM"2<G"2<G"E(X"1 )&VH\"1MJ/ DG)PDG)PDG)PDG)PDG)PI2.0D%"1@I"1@I
- XM"2<G"2<G"2<G"2<G"2<G"E(Q, D""0$)&VH""2<G"2<G"2<G"2<G"2<G"E(Q
- XM,0D$"1MJ9!MJ" D;:F0;:@@))R<)&VID"2<G"2<G"2<G"E(Q,@D&"04)&VH&
- XM"2<G"2<G"2<G"2<G"2<G"E(Q,PD5&S,)&0D9"2<G"1LS"2<G"2<G"2<G"E(Q
- XM- D."1MJ/@D;:CX))R<))R<))R<))R<))R<*4C$U"1@8"1MJ>0D;:GD))R<)
- XM& T))R<))R<))R<*3$5&5 DG)PDG)PDG)PDG)PDG)PDG)PDG)PDG)PI-241$
- XM3$4))R<))R<))R<))R<))R<))R<))R<))R<*4DE'2%0))R<))R<))R<))R<)
- XM)R<))R<))R<))R<*4T5#3TY$05)9"DPR"1@3"148$PD5&!,))R<)&VI^"2<G
- XM"2<G"2<G"DPS"1@&"1LQ& 8)&S$8!@DG)PD;:BTQ& 8))R<))R<))R<*3#0)
- XM&&()&&L)&&L))R<)&VI>"2<G"2<G"2<G"DPY"1MJ"1MJ> D;:G@))R<))R<)
- XM)R<))R<))R<*3#$P"1LH"1MJ> D;:G@))R<))R<))R<))R<))R<*1C$) 1MJ
- XM7 @;:EP-&VHR" X) 2\J( 4@+RH@*B\."0%[( 4@>WT."2<G"2<G"2<G"2<G
- XM"2<G"D8R"0$;:EP(&VI<#0X) 1MJ,P0%&VHV" X) 1MJ,@0%&VHS" X))R<)
- XM)R<))R<))R<))R<*1C,) 1MJ7 @;:EP-(" ."0$O*B %("\J("HO#@D0!1D!
- XM&VHQ&0DG)PDG)PDG)PDG)PDG)PI&- D;:EP) 0L9 0\9( D!+RH@!2 O*B J
- XM+PX))R<))R<))R<))R<))R<*1C4)&VIX9PD8/0D8/0DG)PDG)PDG)PDG)PDG
- XM)PI&-@D;*',)&RAS"1LH<PDG)PDG)PDG)PDG)PDG)PI&-PD;:GAQ( T)&VIX
- XM<2!L87-T#0D;:GAQ(&QA<W0-"2<G"2<G"2<G"2<G"2<G"D8X"1D)&VIX;"!T
- XM#0D;:GAL('0-"2<G"2<G"2<G"2<G"2<G"D8Y"1MJ>0D;:GAC(&0@#0D;:GAC
- XM(&0@#0DG)PDG)PDG)PDG)PDG)PI2,0D;80D;80D;80DG)PDG)PDG)PDG)PDG
- XM)PI2,@D;:G8)&VIV"1MJ=@DG)PDG)PDG)PDG)PDG)PI2,PD;:CP)&VH\"1MJ
- XM/ DG)PDG)PDG)PDG)PDG)PI2- D;8 D;8 D;8 DG)PDG)PDG)PDG)PDG)PI2
- XM-0D6"18)%@DG)PDG)PDG)PDG)PDG)PI2-@D;:CX)&VH^"1MJ/@DG)PDG)PDG
- XM)PDG)PDG)PI2-PD!"1@H"1@H"2<G"2<G"2<G"2<G"2<G"E(X"1 )&VH\"1MJ
- XM/ DG)PDG)PDG)PDG)PDG)PI2.0D%"1@I"1@I"2<G"2<G"2<G"2<G"2<G"E(Q
- XM, D""0$)&VH""2<G"2<G"2<G"2<G"2<G"E(Q,0D$"1MJ9!MJ" D;:F0;:@@)
- XM)R<)&VID"2<G"2<G"2<G"E(Q,@D&"04)&VH&"2<G"2<G"2<G"2<G"2<G"E(Q
- XM,PD5&S,)&0D9"2<G"1LS"2<G"2<G"2<G"E(Q- D."1MJ/@D;:CX))R<))R<)
- XM)R<))R<))R<*4C$U"1@8"1MJ>0D;:GD))R<)& T))R<))R<))R<*3$5&5 DG
- XM)PDG)PDG)PDG)PD;-25C)6,))R<))R<))R<*34E$1$Q%"2<G"2<G"2<G"2<G
- XK"2<G"2<G"2<G"2<G"E))1TA4"2<G"2<G"2<G"2<G"2<G"2<G"2<G"2<G"B<G
- X
- Xend
- END_OF_FILE
- if test 2823 -ne `wc -c <'samples/keytool.defaults.uu'`; then
- echo shar: \"'samples/keytool.defaults.uu'\" unpacked with wrong size!
- fi
- # end of 'samples/keytool.defaults.uu'
- fi
- if test -f 'samples/lpq2.tt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'samples/lpq2.tt'\"
- else
- echo shar: Extracting \"'samples/lpq2.tt'\" \(5436 characters\)
- sed "s/^X//" >'samples/lpq2.tt' <<'END_OF_FILE'
- X#define TRUE 1
- X#define FALSE 0
- X
- X#define HEIGHT 10
- X
- X#define EMPTY_COUNT 6
- X
- X#define CLEAR "^L"
- X#define BOLD_ON "\e[7m"
- X#define BOLD_OFF "\e[m"
- X
- Xapplication "/bin/cat"
- X label "<< Print Queue Monitor >>"
- X size HEIGHT by 80 characters
- X icon "laserwriter.icon"
- X font "/usr/lib/fonts/fixedwidthfonts/screen.r.14"
- X initialize {
- X interval = active_interval; /* set the timer rate for queue checking */
- X active = TRUE; /* start out in active mode */
- X active_count = EMPTY_COUNT; /* successive empty queues before we switch to idle */
- X delimiters = "\n"; /* to tokenize the output of lpq */
- X pr_name[0] = "lw"; /* define the printers we can access */
- X pr_name[1] = "lp";
- X pr_name[2] = "versatec";
- X close_on_idle = TRUE; /* initial option choices */
- X close_option = 0;
- X open_on_active = FALSE;
- X open_option = 1;
- X remove idle_light; /* initialize the main window display */
- X remove check_light;
- X remove remove_options_button;
- X display display_options_button;
- X }
- X open {
- X active = TRUE;
- X interval = active_interval;
- X display active_light;
- X remove idle_light;
- X active_count = EMPTY_COUNT;
- X }
- X close {
- X active = FALSE;
- X interval = idle_interval;
- X display idle_light;
- X remove active_light;
- X active_count = 0;
- X }
- X timer {
- X remove active_light;
- X remove idle_light;
- X display check_light;
- X queue = tokenize(output_of(format("lpq -P%s", pr_name[printer])));
- X remove check_light;
- X send CLEAR, BOLD_ON, queue[0], BOLD_OFF, "\n\n";
- X if (queue[0] == "no entries")
- X if (active)
- X if (--active_count == 0) {
- X active = FALSE;
- X display idle_light;
- X interval = idle_interval;
- X if (close_on_idle && is_open())
- X close;
- X }
- X else
- X display active_light;
- X else
- X display idle_light;
- X else {
- X active = TRUE;
- X active_count = EMPTY_COUNT;
- X display active_light;
- X interval = active_interval;
- X if (open_on_active && !is_open())
- X open;
- X for (i = 1; i < HEIGHT - 1 && i < cardinality(queue); i++)
- X if (index(queue[i], user()))
- X send BOLD_ON, queue[i], BOLD_OFF, "\n";
- X else
- X send queue[i], "\n";
- X }
- X }
- X
- Xgadgets
- X top
- X align middle
- X font "/usr/lib/fonts/fixedwidthfonts/screen.b.14"
- X label active_light
- X at 49 4
- X "Active"
- X end_label
- X label idle_light
- X at 303 4
- X "Idle"
- X end_label
- X label check_light
- X at 529 4
- X "Checking"
- X end_label
- X button
- X at 4 24
- X normal " Go Active " /* spaces set size of all buttons */
- X { active = TRUE;
- X interval = active_interval;
- X remove idle_light;
- X display active_light;
- X active_count = EMPTY_COUNT;
- X }
- X end_button
- X button
- X at 249 24
- X normal "Go Idle"
- X { active = FALSE;
- X interval = idle_interval;
- X remove active_light;
- X display idle_light;
- X active_count = 0;
- X if (close_on_idle)
- X close;
- X }
- X end_button
- X button display_options_button
- X at 493 24
- X normal "Options"
- X display option_dialog;
- X end_button
- X button remove_options_button
- X at 493 24
- X normal "Remove Options"
- X remove option_dialog;
- X end_button
- Xend_gadgets
- X
- Xdialog option_dialog
- X label "<< Print Queue Monitor Options >>"
- X size 24 by 92 characters
- X open {
- X remove display_options_button;
- X display remove_options_button;
- X }
- X close {
- X remove remove_options_button;
- X display display_options_button;
- X }
- X gadgets
- X align middle
- X font "/usr/lib/fonts/fixedwidthfonts/screen.b.14"
- X slider active_interval
- X at 4 78
- X label "Active Interval:"
- X value on
- X range off
- X minimum 5
- X maximum 300
- X initial 10
- X width 100
- X action {
- X if (active)
- X interval = active_interval;
- X }
- X end_slider
- X slider idle_interval
- X at 4 116
- X label "Idle Interval: "
- X value on
- X range off
- X minimum 5
- X maximum 300
- X initial 60
- X width 100
- X action {
- X if (!active)
- X interval = idle_interval;
- X }
- X end_slider
- X choice printer
- X at 4 4
- X display vertical
- X label "Printer:"
- X "LaserWriter" nothing;
- X "Line Printer" nothing;
- X "Versatec Plotter" nothing;
- X end_choice
- X label
- X at 320 4
- X "When the queue becomes active..."
- X end_label
- X choice open_option
- X at 345 24
- X display vertical
- X "Open the window" open_on_active = TRUE;
- X "Do not change the window's status" open_on_active = FALSE;
- X end_choice
- X label
- X at 320 78
- X "When the queue becomes idle..."
- X end_label
- X choice close_option
- X at 345 98
- X display vertical
- X "Close the window" close_on_idle = TRUE;
- X "Do not change the window's status" close_on_idle = FALSE;
- X end_choice
- X end_gadgets
- Xend_dialog
- X
- Xkeys
- X disable normal_keys
- X disable function_keys
- Xend_keys
- END_OF_FILE
- if test 5436 -ne `wc -c <'samples/lpq2.tt'`; then
- echo shar: \"'samples/lpq2.tt'\" unpacked with wrong size!
- fi
- # end of 'samples/lpq2.tt'
- fi
- if test -f 'samples/top.tt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'samples/top.tt'\"
- else
- echo shar: Extracting \"'samples/top.tt'\" \(4324 characters\)
- sed "s/^X//" >'samples/top.tt' <<'END_OF_FILE'
- Xapplication "top"
- X size 16 by 80 characters
- X font "/usr/lib/fonts/fixedwidthfonts/screen.b.14"
- X icon "top.icon"
- X label "<< Top >>"
- X at 156 0
- X close "s1000\n"
- X open "s5\n"
- Xgadgets
- X top
- X align middle
- X font "/usr/lib/fonts/fixedwidthfonts/screen.b.14"
- X button
- X normal "Close" close;
- X shift "Exit" send "q";
- X end_button
- X slider interval
- X label "Display Interval:"
- X range off
- X value on
- X initial 5
- X minimum 1
- X maximum 240
- X width 227
- X action send format("s%d\n", interval);
- X end_slider
- X button
- X normal "Kill a Process" display kill_process_dialog;
- X end_button
- X button
- X normal " Change Process Priority " display change_process_dialog;
- X end_button
- X button
- X normal "Show Errors" send "e";
- X end_button
- Xend_gadgets
- Xdialog kill_process_dialog
- X size 24 by 50 characters
- X gadgets
- X align middle
- X font "/usr/lib/fonts/fixedwidthfonts/screen.b.14"
- X label
- X "Enter the pid of the process to be killed"
- X end_label
- X button
- X normal "OK" { if (verify(kill_pid, "0123456789")) {
- X send format("k%d\n", kill_pid);
- X remove kill_process_dialog;
- X }
- X else
- X popup invalid_pid;
- X }
- X end_button
- X text kill_pid
- X label "Pid:"
- X font "/usr/lib/fonts/fixedwidthfonts/screen.r.14"
- X trigger "\n\r"
- X display 20
- X action { if (verify(kill_pid, "0123456789")) {
- X send format("k%d\n", kill_pid);
- X remove kill_process_dialog;
- X }
- X else
- X popup invalid_pid;
- X }
- X end_text
- X button
- X normal "Cancel" remove kill_process_dialog;
- X end_button
- X end_gadgets
- Xend_dialog
- Xdialog change_process_dialog
- X size 24 by 60 characters
- X gadgets
- X align middle
- X font "/usr/lib/fonts/fixedwidthfonts/screen.b.14"
- X label
- X "Enter the pid of the process, and its new priority"
- X end_label
- X button
- X normal "OK" { if (verify(change_pid, "0123456789"))
- X if (verify(priority, "-0123456789") && priority >= -20 && priority <= 20) {
- X send format("r%d %d\n", priority, change_pid);
- X remove change_process_dialog;
- X }
- X else
- X popup invalid_priority;
- X else
- X popup invalid_pid;
- X }
- X end_button
- X text change_pid
- X label "Pid:"
- X font "/usr/lib/fonts/fixedwidthfonts/screen.r.14"
- X trigger "\n\r"
- X display 10
- X action { if (verify(change_pid, "0123456789"))
- X if (verify(priority, "-0123456789") && priority >= -20 && priority <= 20) {
- X send format("r%d %d\n", priority, change_pid);
- X remove change_process_dialog;
- X }
- X else
- X popup invalid_priority;
- X else
- X popup invalid_pid;
- X }
- X end_text
- X text priority
- X label "Priority:"
- X font "/usr/lib/fonts/fixedwidthfonts/screen.r.14"
- X trigger "\n\r"
- X display 10
- X action { if (verify(change_pid, "0123456789"))
- X if (verify(priority, "-0123456789") && priority >= -20 && priority <= 20) {
- X send format("r%d %d\n", priority, change_pid);
- X remove change_process_dialog;
- X }
- X else
- X popup invalid_priority;
- X else
- X popup invalid_pid;
- X }
- X end_text
- X button
- X normal "Cancel" remove change_process_dialog;
- X end_button
- X end_gadgets
- Xend_dialog
- Xdialog invalid_pid
- X gadgets
- X font "/usr/lib/fonts/fixedwidthfonts/screen.b.14"
- X align middle
- X ragged
- X label
- X "The specified pid is not valid "
- X end_label
- X button
- X normal " OK " remove invalid_pid;
- X end_button
- X end_gadgets
- Xend_dialog
- Xdialog invalid_priority
- X gadgets
- X font "/usr/lib/fonts/fixedwidthfonts/screen.b.14"
- X align middle
- X ragged
- X label
- X "The specified priority is not valid "
- X end_label
- X button
- X normal " OK " remove invalid_priority;
- X end_button
- X end_gadgets
- Xend_dialog
- END_OF_FILE
- if test 4324 -ne `wc -c <'samples/top.tt'`; then
- echo shar: \"'samples/top.tt'\" unpacked with wrong size!
- fi
- # end of 'samples/top.tt'
- fi
- if test -f 'samples/vt100/edtkeys.ras.uu' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'samples/vt100/edtkeys.ras.uu'\"
- else
- echo shar: Extracting \"'samples/vt100/edtkeys.ras.uu'\" \(4440 characters\)
- sed "s/^X//" >'samples/vt100/edtkeys.ras.uu' <<'END_OF_FILE'
- Xbegin 644 edtkeys.ras
- XM6:9JE0 +P "$ 0 #& !
- XM /____________
- XM_________________X ( ! ( ! ( ( !
- XM ( ! ( ( ! ';[CP ( ?S;? !!Y]P!P ( (
- XM ! "1)!( ( )9*5 ! DD@ @ ( ( ! "1!!( ( (9*$ ! D@@ @ ( (
- XM ! #QQ!( ( .5$$ ! DX@ @ ( ( ! "1!!P ( (5$$ ! D@@ @
- XM ( ( ! "1!! ( (3*$ ! D@@ @ ( ( ! "1)) ( (3*$ ! D
- XMDD D ( ( ! ';[[@ ( <Q;. !!Y]\!\ ( ( ! (
- XM ! ( ( ! ( ! ( ('QSQ\ ! (
- XM ! ( (,R9@V ! ( ! ( (,&9@V !
- XM ( ?O\[X!#OG? '@( (,&9@V ! ( ,C$1L!!DB-@# ( (-V9@V !
- XM ( ,#&1L!!DR-@# ( (,V9@V ! ( /#'1L!!DZ-@# ( (,V1D
- XMV ! ( ,#'QL!!D^-@# ( ('CC]\ ! ( ,#%QL!!DN-@# ( (
- XM ! ( ,#$QL!!DF-@#(( ( ! ( >/^3X! YR? '
- XMX( ( ! ( ! ( ( ! ( !
- XM ( ( ! ( ! ( /____________________
- XM_________X ( ! ( ! ( ( ! (
- XM ! ( ( >,/? ! ![Y[X (&///YO!!Y]P#L ( ( )$1) ! ")**
- XMH ("$DDLDA DD@!$ ( ( ),0( ! "!" @ (&$DD,DA D@@!$ ( ( )*0. !
- XM!AR @ (%$DG*DA DX@!4 ( ( .*3( ! 1" @ (%''$*DA D@@!4 ( ( (>1
- XM( ! )" @ (/$$$)DA D@@ H ( ( (21) ! ")*(@ ()$$$IDA DDD H ( (
- XM <S.? ! #SYQP (9N./XO!!Y]\ H ( ( ! ( !
- XM ( ( ! ( ! ( ( ! ( !
- XM ( ( ! ( ! ( ('QV/.^! '[]X\ (!\_?/
- XM !#OG? .X( (,R:)$;! #(PP8 ( V9-F !!DB-@$0( (,&;9D;! # PP8 (
- XMV8-F !!DR-@%0( (,&;9T;! #PPP8 ( V>-F !!DZ-@%0( (,&;Y\;! # PP
- XM8 ( \8/& !!D^-@'P( (,&:I<;! # PP8 ( V8,& !!DN-@"@( (,V2I,;!
- XM# PR9 ( V9,&0!!DF-@"@( ('CF/D^! 'C]^_ (!V_>/P! YR? "@( (
- XM ! ( ! ( ( ! ( ! (P(
- XM ! ( ! (@( ! ( !
- XM (@/_____________________________X@( ! ( !
- XM (@( ! ( ! (@(&/=IGOA!XP]OMX( ?V^
- XM !!Y]P \ (D("$HLHDA D1$I(D( BDJ ! DD@!$ (\(&$HLH$! DQ Q(D(
- XM @D( ! D@@! ( (%$E*H'! XI Q(D( @D( ! DX@! ( (%$E*H$! DI I
- XM(X( @D( ! D@@! ( (/$E)H$! EY I(@( @D( ! D@@! ( ()$B)HDA
- XME)$E(@( BD( ! DDD!$ (\(9O"8G/A![,YLQP( <8< !!Y]\ X ( (
- XM ! ( ! ( ( ! ( ! (\(
- XM/AS]_C! #\<^ (/CAY^_!#OG? #X(4(&R:U:B! "TF; (&QC):9!!DB-@&
- XM8(0(&V8P8V! QF; (&QS 88!!DR-@& (0('F8P8V! QF; (&S1P8>!!D
- XMZ-@& (0(&V8P8^! QF> ('B0888!!D^-@& (0(&V8P8J! QF8 (&'X88
- XM8!!DN-@& (0(&V0P8J! QD8 (&&:889!!DF-@&8(X(/CAX]C! !XX\ (/
- XM.;P\_! YR? #P( ( ! ( ! ( ( !
- XM ( ! ( ( ! ( ! ( ( !
- XM ( ! ( /_____________________________X (
- XM ! ( ! ( ( ! ( ! (\(
- XM [.>> ! 'SG ( /[,> !!\ @ (T( 19)) ! "62 ( 12$) ! D @
- XM (P( 11)) ! "$2 ( 02,) ! BQXQL (P( 51)) ! #D2 ( 0>*) ! Y
- XM(A(T (P( 51.) ! "$2 ( 02*. ! A(AX@ (P( *1*) ! "$2 ( 02>*
- XM ! A(A @ (P( *3)) ! "4R0 ( 122) ! E(A(@ (X( *.9> ! 'SGP (
- XM.[S9 !!_L8QP ( ( ! ( ! ( ( !
- XM ( ! ( ( #YP\_!^?@'XYX( /\YX! ]W?'@ ( ( &8QD9 ;
- XM,@#),P( #$3(!!DR-L@ (\(.V Y@8 ;, ##,P( =C&3 !!@R-L ( (&F!H
- XMX> ;/ #S,P( -#'1P! XR/' ( (#&!(,8 ;, ##,P( 'P8! ,R-A@ (\(
- XM#\,8 ;, ##,P( %P8! ,R-A@ (0(%F;-,9 ;,@#+(R( +#$R8!!,R-I@
- XM (0(-SW-X_ ^?@'YQ^( ;O^3P!!X<?/ (0( ( !
- XM (<( ( ! (4( (
- XM ! (0( ! ( ! (P/________________
- XM_____________X ( ! ( ! ( !
- XM ( ! ( <?S? ! ('ON/GOA ( ($9) !
- XM ((DD$HJA ( ($9( ! (($$$("! ( ($5
- XM. ! (&'$'("! ( ($5( ! (!$$$("! P(
- XM ($3( ! ( D$$("! D( )$3) ! ((DDDHB!
- XM D( ??Q? ! (//OOG'! @( ! ( !
- XM @( ! ( ! @( '/G^<! (/GYY^
- XM_! D( )FS*(! (&S+(RM! D( 9FS#(! (&
- XMS# P,! ( 9FSSH! (&SQP\,! ( 9GC#X!
- XM ('C 8P,! ( 9F#"X! (&S 8P,! ( 9*8!
- XM (&S*8R,! \( ./'_(! (.W[Q^>! (
- XM ! ( ! ( ! ( ! ,(
- XM ! ( ! 0( ! ( !
- XM 0/_______ /_______ 0
- X% 3_
- X
- Xend
- END_OF_FILE
- if test 4440 -ne `wc -c <'samples/vt100/edtkeys.ras.uu'`; then
- echo shar: \"'samples/vt100/edtkeys.ras.uu'\" unpacked with wrong size!
- fi
- # end of 'samples/vt100/edtkeys.ras.uu'
- fi
- if test -f 'samples/vt100/vt102tool.tt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'samples/vt100/vt102tool.tt'\"
- else
- echo shar: Extracting \"'samples/vt100/vt102tool.tt'\" \(3707 characters\)
- sed "s/^X//" >'samples/vt100/vt102tool.tt' <<'END_OF_FILE'
- X/*
- X * simple tooltool command file for creating a vt100 emulator with
- X * standard VT100 keypad (plus a few from VT320), plus a keyboard template.
- X * standard templates are provided for EDT and ANU News. More could be
- X * added. This was a quick hack, and needs further work.
- X * See also vttool, which is a standalone vtem wrapper providing similar
- X * functionality.
- X *
- X * Last edit: 8 April 1989 by jqj@hogg.cc.uoregon.edu
- X */
- X
- Xapplication "vtem"
- X label "vt102tool"
- X size 24 by 81 characters
- X initialize {remove EDThelp;}
- X icon "/usr/local/images/vt.icon"
- Xgadgets
- X /* place the keypad at the bottom */
- X bottom
- X align top
- X ragged
- X /* unfortunately, we are forced to hardwire the font */
- X /* since we are hardwiring the locations of buttons */
- X font "/usr/lib/fonts/fixedwidthfonts/screen.b.12"
- X#define ROW_1 5
- X#define ROW_2 30
- X#define ROW_3 55
- X#define ROW_4 80
- X#define ROW_5 105
- X#define COL_1 5
- X#define COL_2 54
- X#define COL_3 103
- X#define COL_4 152
- X#define COL_5 201
- X#define COL_6 250
- X#define COL_7 299
- X#define COL_8 348
- X#define COL_9 397 /* unused */
- X#define COL_10 446 /* unused */
- X
- X button PF1
- X at COL_1 ROW_1
- X normal "PF1" send "\eOP";
- X end_button
- X button PF2
- X at COL_2 ROW_1
- X normal "PF2" send "\eOQ";
- X end_button
- X button PF3
- X at COL_3 ROW_1
- X normal "PF3" send "\eOR";
- X end_button
- X button PF4
- X at COL_4 ROW_1
- X normal "PF4" send "\eOS";
- X end_button
- X button n7
- X at COL_1 ROW_2
- X normal "7" send "\eOw";
- X end_button
- X button n8
- X at COL_2 ROW_2
- X normal "8" send "\eOx";
- X end_button
- X button n9
- X at COL_3 ROW_2
- X normal "9" send "\eOy";
- X end_button
- X button minus
- X at COL_4 ROW_2
- X normal "-" send "\eOm";
- X end_button
- X button n4
- X at COL_1 ROW_3
- X normal "4" send "\eOt";
- X end_button
- X button n5
- X at COL_2 ROW_3
- X normal "5" send "\eOu";
- X end_button
- X button n6
- X at COL_3 ROW_3
- X normal "6" send "\eOv";
- X end_button
- X button comma
- X at COL_4 ROW_3
- X normal "," send "\eOl";
- X end_button
- X button n1
- X at COL_1 ROW_4
- X normal "1" send "\eOq";
- X end_button
- X button n2
- X at COL_2 ROW_4
- X normal "2" send "\eOr";
- X end_button
- X button n3
- X at COL_3 ROW_4
- X normal "3" send "\eOs";
- X end_button
- X button ENTER
- X at COL_4 ROW_4
- X normal "Ent" send "\eOM";
- X end_button
- X button n0
- X at COL_1 ROW_5
- X normal "0" send "\eOp";
- X end_button
- X button period
- X at COL_3 ROW_5
- X normal "." send "\eOn";
- X end_button
- X
- X /* some VT320 extended keys */
- X button FindKey
- X at COL_5 ROW_2
- X normal "Find" send "\e[1~";
- X end_button
- X button InsertKey
- X at COL_6 ROW_2
- X normal "Ins." send "\e[2~";
- X end_button
- X button RemoveKey
- X at COL_7 ROW_2
- X normal "Rem." send "\e[3~";
- X end_button
- X button SelectKey
- X at COL_5 ROW_3
- X normal "Sel." send "\e[4~";
- X end_button
- X button PrevScreenKey
- X at COL_6 ROW_3
- X normal "Prev" send "\e[5~";
- X end_button
- X button NextScreenKey
- X at COL_7 ROW_3
- X normal "Next" send "\e[6~";
- X end_button
- X
- X /* arrow keys */
- X button uparrow
- X at COL_6 ROW_4
- X normal "\136" send "\e[A";
- X end_button
- X button leftarrow
- X at COL_5 ROW_5
- X normal "<" send "\e[D";
- X end_button
- X button rightarrow
- X at COL_7 ROW_5
- X normal ">" send "\e[C";
- X end_button
- X button downarrow
- X at COL_6 ROW_5
- X normal "V" send "\e[B";
- X end_button
- X
- X /* keypad templates. Only one will be visible at a time. */
- X label NEWShelp
- X at COL_8 1
- X '/usr/local/images/newskeys.ras'
- X end_label
- X label EDThelp
- X at COL_8 1
- X '/usr/local/images/edtkeys.ras'
- X end_label
- X
- X choice helplabel
- X at COL_5 ROW_1
- X display cycle
- X label " help:"
- X "ANU News" {remove EDThelp; display NEWShelp;}
- X "EDT" {remove NEWShelp; display EDThelp;}
- X end_choice
- X
- Xend_gadgets
- END_OF_FILE
- if test 3707 -ne `wc -c <'samples/vt100/vt102tool.tt'`; then
- echo shar: \"'samples/vt100/vt102tool.tt'\" unpacked with wrong size!
- fi
- # end of 'samples/vt100/vt102tool.tt'
- fi
- if test -f 'samples/vt100/vtem.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'samples/vt100/vtem.c'\"
- else
- echo shar: Extracting \"'samples/vt100/vtem.c'\" \(4952 characters\)
- sed "s/^X//" >'samples/vt100/vtem.c' <<'END_OF_FILE'
- X/*
- X * vtem - A termcap driven VT100 emulator for BSD Unix
- X *
- X * $Header: /home/src/local/vttool/vtem.c,v 1.2 89/02/07 14:20:13 jqj Exp $
- X *
- X * Public domain software.
- X * Written by Leif Samuelsson (lsamuelsson@erisun) in December, 1985
- X *
- X * History:
- X *
- X * $Log: vtem.c,v $
- X * Revision 1.2 89/02/07 14:20:13 jqj
- X * Major revision of vtem to support more complete VT100 emulation. Most
- X * changes are to out.c. Changes to this module include:
- X * 1/ get termcap data before setupterm() so that TI gets called properly
- X * (needed for Sun cmdtool to turn off scroll bar).
- X * 2/ support for varying TERM values (this may be a bad idea since old copies
- X * of /etc/termcap did not include a vt102 entry).
- X *
- X * 1988-02-10 Version 1.1+gnu1+bgb - added ability to pass parameters
- X * to the shell process
- X *
- X * 1987-07-01 Version 1.1+gnu1. Bug fixes for setting tabs in column
- X * 81 (crashes when you run 'reset'), and for setting the
- X * environment variables TERM and TERMCAP.
- X *
- X * 1986-04-25 Version 1.1 posted to net.sources. This version contains
- X * bug fixes and some new code for simulating semi-graphics.
- X *
- X * 1986-01-30 Version 1.0 posted to mod.sources
- X */
- X
- X#include "vtem.h"
- X#include <sys/wait.h>
- X#include <sys/param.h>
- X
- Xint master, slave, child;
- Xchar linec, linen;
- Xchar arg_list[NCARGS];
- Xchar *Argv[4];
- X
- X/* suggestion from Marcus Moehrmann <marcus@fkihh.UUCP>
- X so this works witn SunOS 3.0 */
- X#ifdef SUN30
- X#define putenv(STRING) 1
- X#endif
- X
- Xdone()
- X{
- Xunion wait status;
- X
- X if (wait3(&status, WNOHANG, 0) != child)
- X return;
- X setupterm(0);
- X exit(0);
- X}
- X
- Xmain(argc, argv)
- X int argc;
- X char **argv;
- X{
- X int i;
- X /* allocate enough space for the argument list */
- X /* - that is - Argv */
- X /* reserve two parameters for the begining */
- X /* first = tail of shell */
- X /* second = "-i" -> interactive mode */
- X /* third = "-c" -> argument list is command */
- X /* forth - the string with one or more arguments */
- X /* NOTE - args 3 and 4 may be nil */
- X
- X
- X/* Argv[0] will be filled in later -see use of the tail variable */
- X if ( argc > 1 ) /* then we have to pass arguments to a subshell */ {
- X Argv[1] = "-c";
- X Argv[2] = arg_list;
- X for (i=1;i<argc;i++) {
- X strcat(arg_list,*(argv+i)); strcat(arg_list," ");
- X }
- X Argv[3] = (char *) 0;
- X } else {
- X Argv[1] = "-i";
- X Argv[2] = (char *) 0;
- X }
- X
- X /* Start three processes, one for input, one for output
- X * and one shell.
- X */
- X setup_master();
- X gettermtype(); /* do this before setupterm! */
- X setupterm(TRUE);
- X signal(SIGCHLD, done);
- X if (child = fork())
- X handle_input();
- X else {
- X if (fork())
- X handle_output();
- X else
- X start_shell();
- X }
- X}
- X
- Xhandle_input()
- X{
- Xchar buf[BUFSIZ];
- Xint i;
- X
- X while (i = read(0, buf, BUFSIZ))
- X write(master, buf, i);
- X setupterm(0);
- X exit(0);
- X}
- X
- X
- Xstart_shell()
- X{
- Xint t;
- Xchar *term, *getenv(), *shell, *tail, *rindex();
- X
- X switch (vttype) {
- X case VT52: term = "TERM=vt52"; break;
- X default:
- X case VT100: term = "TERM=vt100"; break;
- X case VT102: term = "TERM=vt102"; break;
- X }
- X if (0 != putenv(term))
- X fprintf(stderr, "Set terminal type to \"%s\" manually.\r\n",
- X term);
- X term = getenv("TERMCAP");
- X if (term && term[0] != '/') {
- X /* TERMCAP contains a termcap entry for the old terminal
- X * type. Kill it. We would not have to do this if termcap
- X * didn't have the bug that if TERMCAP is specified and
- X * the TERM value is not found in it, /etc/termcap is not
- X * searched.
- X */
- X if (0 != putenv("TERMCAP="))
- X fprintf(stderr, "Unset TERMCAP manually.\r\n");
- X }
- X
- X /* Then fork the shell
- X */
- X if ((shell = getenv("SHELL")) == (char *) 0)
- X shell = "/bin/sh";
- X if ((tail = rindex(shell, '/')) == (char *) 0)
- X tail = "sh";
- X else
- X tail++;
- X if ((t = open("/dev/tty", 2)) >= 0) {
- X ioctl(t, TIOCNOTTY, (char *)0);
- X close(t);
- X }
- X setup_slave();
- X close(master);
- X dup2(slave, 0);
- X dup2(slave, 1);
- X dup2(slave, 2);
- X close(slave);
- X/* now construct an array for exec */
- X Argv[0] = tail;
- X execv(shell, Argv );
- X perror(shell);
- X fail();
- X}
- X
- Xfail()
- X{
- X kill(0, SIGTERM);
- X setupterm(0);
- X exit(0);
- X}
- X
- X
- Xsetup_master()
- X{
- Xchar line[11];
- X
- X for (linec = 'p'; linec <= 's'; linec++) {
- X sprintf(line, "/dev/pty%c0", linec);
- X if (access(line, 0) != 0)
- X break;
- X for (linen = 0; linen < 16; linen++) {
- X sprintf(line, "/dev/pty%c%1x", linec, linen);
- X master = open(line, 2);
- X if (master >= 0) {
- X return;
- X }
- X }
- X }
- X fprintf(stderr, "Can't find a pty\n");
- X fail();
- X}
- X
- Xsetup_slave()
- X{
- Xchar line[11];
- X
- X sprintf(line, "/dev/tty%c%1x", linec, linen);
- X slave = open(line, 2);
- X if (slave < 0) {
- X perror(line);
- X fail();
- X }
- X ioctl(slave, TIOCSETP, (char *)&oldb);
- X ioctl(slave, TIOCSETC, (char *)&oldtchars);
- X ioctl(slave, TIOCSLTC, (char *)&oldltchars);
- X ioctl(slave, TIOCLSET, (char *)&oldlb);
- X ioctl(slave, TIOCSETD, (char *)&oldl);
- X}
- END_OF_FILE
- if test 4952 -ne `wc -c <'samples/vt100/vtem.c'`; then
- echo shar: \"'samples/vt100/vtem.c'\" unpacked with wrong size!
- fi
- # end of 'samples/vt100/vtem.c'
- fi
- if test -f 'symbols.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'symbols.c'\"
- else
- echo shar: Extracting \"'symbols.c'\" \(3946 characters\)
- sed "s/^X//" >'symbols.c' <<'END_OF_FILE'
- X/************************************************************************/
- X/* Copyright 1988 by Chuck Musciano and Harris Corporation */
- X/* */
- X/* Permission to use, copy, modify, and distribute this software */
- X/* and its documentation for any purpose and without fee is */
- X/* hereby granted, provided that the above copyright notice */
- X/* appear in all copies and that both that copyright notice and */
- X/* this permission notice appear in supporting documentation, and */
- X/* that the name of Chuck Musciano and Harris Corporation not be */
- X/* used in advertising or publicity pertaining to distribution */
- X/* of the software without specific, written prior permission. */
- X/* Chuck Musciano and Harris Corporation make no representations */
- X/* about the suitability of this software for any purpose. It is */
- X/* provided "as is" without express or implied warranty. */
- X/* */
- X/* The sale of any product based wholely or in part upon the */
- X/* technology provided by tooltool is strictly forbidden without */
- X/* specific, prior written permission from Harris Corporation. */
- X/* Tooltool technology includes, but is not limited to, the source */
- X/* code, executable binary files, specification language, and */
- X/* sample specification files. */
- X/************************************************************************/
- X
- X#include <stdio.h>
- X#include <ctype.h>
- X#include <sys/types.h>
- X#include <sys/dir.h>
- X#include <pwd.h>
- X
- X#include <suntool/sunview.h>
- X#include <suntool/icon_load.h>
- X
- X#include "tooltool.h"
- X
- XPRIVATE s_ptr symbols = NULL;
- X
- X/************************************************************************/
- XPRIVATE s_ptr create_symbol(name, sp)
- X
- Xchar *name;
- Xs_ptr *sp;
- X
- X{
- X while (*sp)
- X if (strcmp(name, (*sp)->name) < 0)
- X sp = &((*sp)->left);
- X else
- X sp = &((*sp)->right);
- X *sp = (s_ptr) safe_malloc(sizeof(s_data));
- X (*sp)->name = strsave(name);
- X (*sp)->kind = SYMBOL_SYMBOL;
- X (*sp)->gadget = NULL;
- X (*sp)->dialog = NULL;
- X (*sp)->left = NULL;
- X (*sp)->right = NULL;
- X (*sp)->value = (v_ptr) safe_malloc(sizeof(v_data));
- X (*sp)->value->kind = V_NOTHING;
- X (*sp)->value->number = 0.0;
- X (*sp)->value->str = "";
- X (*sp)->value->value = NULL;
- X (*sp)->value->left = NULL;
- X (*sp)->value->right = NULL;
- X (*sp)->value->index = NULL;
- X return(*sp);
- X}
- X
- X/************************************************************************/
- XEXPORT s_ptr tt_find_symbol(name)
- X
- Xchar *name;
- X
- X{ s_ptr s;
- X int i;
- X
- X for (s = symbols; s; )
- X if ((i = strcmp(name, s->name)) == 0)
- X break;
- X else if (i < 0)
- X s = s->left;
- X else
- X s = s->right;
- X if (s == NULL)
- X s = create_symbol(name, &symbols);
- X return(s);
- X}
- X
- X/************************************************************************/
- XEXPORT v_ptr tt_get_value(s)
- X
- Xs_ptr s;
- X
- X{ v_ptr v;
- X static char buf[20];
- X
- X if (s == NULL)
- X return(NULL);
- X else if (s->kind == SYMBOL_SYMBOL)
- X return(s->value);
- X else if (s->kind == SYMBOL_DIALOG)
- X abend("attempted to get value of dialog box %s", s->name);
- X else {
- X switch (s->gadget->kind) {
- X case GADGET_TEXT : v = tt_string_result(panel_get(s->gadget->panel_item, PANEL_VALUE));
- X break;
- X case GADGET_CHOICE :
- X case GADGET_SLIDER : v = tt_int_result(panel_get(s->gadget->panel_item, PANEL_VALUE));
- X break;
- X/* case GADGET_LABEL : v = tt_string_result(panel_get(s->gadget->panel_item, PANEL_LABEL_STRING));
- X break;*/
- X default : v = tt_int_result(0);
- X }
- X v->kind |= V_GADGET;
- X v->gadget = s->gadget;
- X return(v);
- X }
- X}
- X
- X/************************************************************************/
- XEXPORT tt_make_intrinsic_symbols()
- X
- X{ s_ptr interval;
- X
- X tt_mouse_x = tt_find_symbol("mouse_x");
- X tt_mouse_y = tt_find_symbol("mouse_y");
- X interval = tt_find_symbol("interval");
- X interval->value->kind |= V_INTERVAL;
- X tt_delimiters = tt_find_symbol("delimiters");
- X tt_delimiters->value->kind = 0;
- X tt_delimiters->value->str = " \t\n\r\"'";
- X}
- END_OF_FILE
- if test 3946 -ne `wc -c <'symbols.c'`; then
- echo shar: \"'symbols.c'\" unpacked with wrong size!
- fi
- # end of 'symbols.c'
- fi
- echo shar: End of archive 2 \(of 13\).
- cp /dev/null ark2isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 13 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-
-
- Chuck Musciano ARPA : chuck@trantor.harris-atd.com
- Harris Corporation Usenet: ...!uunet!x102a!trantor!chuck
- PO Box 37, MS 3A/1912 AT&T : (407) 727-6131
- Melbourne, FL 32902 FAX : (407) 727-{5118,5227,4004}
-